package com.xyht.sca_s.student_manage_system.modules.visitor.controller;

import com.xyht.sca_s.student_manage_system.common.annotation.VisitorRequestCheck;
import com.xyht.sca_s.student_manage_system.common.commonReturn.ResponseResult;
import com.xyht.sca_s.student_manage_system.common.desEncodeAndDecode.annotation.SecretBody;
import com.xyht.sca_s.student_manage_system.modules.visitor.entity.vo.SmsVisitorManageVO;
import com.xyht.sca_s.student_manage_system.modules.visitor.service.SmsVisitorManageService;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@SecretBody
@VisitorRequestCheck
@RestController
@RequestMapping("/visitor")
public class SmsVisitorManageController {
    @Autowired
    private SmsVisitorManageService smsVisitorManageService;

    @ApiModelProperty(value = "新增访客记录")
    @PostMapping("/visitorAdd")
    public ResponseResult visitorAdd (@RequestBody SmsVisitorManageVO visitorManage) {
        return smsVisitorManageService.visitorAdd(visitorManage);
    }
    @ApiModelProperty(value = "删除访客记录")
    @DeleteMapping("/deleteVisitor")
    public ResponseResult deleteVisitor (@RequestBody SmsVisitorManageVO visitorManage) {
        return smsVisitorManageService.deleteVisitor(visitorManage);
    }

    @ApiOperation("查询访客记录")
    @GetMapping("/selectVisitor")
    public ResponseResult selectVisitor(@RequestParam(value = "search_str", required = false) String search_str,
                                     @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                     @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                     @RequestParam(value = "bg_date", required = false) String bg_date,
                                     @RequestParam(value = "end_date", required = false) String end_date) {
        return smsVisitorManageService.selectVisitor(search_str,pageSize, pageNum,bg_date,end_date);
    }

}
